package cn.tedu;

import java.sql.*;

public class Demo03 {
    public static void main(String[] args) throws SQLException {
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/empdb?characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false",
                "root", "123456");

        Statement s = con.createStatement();

//        s.execute("delete from emp where id in (13,14)");

        //遍历结果集对象
        ResultSet resultSet = s.executeQuery("select * from emp");
        while (resultSet.next()){
            String name=resultSet.getString("name");
            double sal = resultSet.getDouble("sal");
            String job = resultSet.getString("job");
            System.out.println(name+":"+sal+":"+job);
        }


        con.close();

    }
}
